import { setSession, getSession } from "../utils"

export default {
    namespaced: true,
    // 仓库数据做持久化的操作

    state: {
        token: sessionStorage.getItem("user") || [],
        user: JSON.parse(sessionStorage.getItem("user")) || [],
        list: [],
        photo: []
    },

    mutations: {
        setToken: (state, token) => {
            state.token = token
            localStorage.setItem("token", token)
        },
        isLogin: (state, user) => {
            state.user = user
            sessionStorage.setItem("user", JSON.stringify(user))
        },

    },

    getters: {
        getUser: state => {
            return state.userInfo
        }
    },

    actions: {

    },
}

